<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>定时器</title>
</head>
<body>
<script>
    //使用async设置定时器,并间隔时间来输出内容
    async function sleep(ms = 2000){
        return new Promise(resolve => {
            setTimeout(resolve,ms);
        });
    }

    async function run(){
        for(const value of ["后盾人","向军"]){
            await sleep();
            console.log(value);
        }
    }
    run();
</script>
</body>
</html>